<!DOCTYPE html>
<html class="x-admin-sm">

<head>
    {include file='base/common_header'}
    <style>
        .layui-table td, .layui-table th { min-width: auto; }
    </style>
</head>

<body>
<div class="x-nav">
            <span class="layui-breadcrumb">
                <a href="/admin">首页</a>
                <a href="/admin/permission/list">权限管理列表</a>
            </span>
    <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" onclick="location.reload()" title="刷新">
        <i class="layui-icon layui-icon-refresh" style="line-height:30px"></i>
    </a>
</div>
<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-body ">
                    <form class="layui-form layui-col-space5">
                        <div class="layui-input-inline layui-show-xs-block">
                            <button type="button" class="layui-btn" onclick="xadmin.open('添加','/admin/permission/add','','',true)">
                                <i class="layui-icon"></i>添加</button>
                        </div>
                    </form>
                </div>
                <div class="layui-card-body ">
                    <table class="layui-table layui-form">
                        <thead>
                        <tr>
                            <th>ID</th>
                            <th>权限名称</th>
                            <th>权限路由</th>
                            <th>操作</th></tr>
                        </thead>
                        <tbody>
                        {volist name='list' id='type'}
                        <tr>
                            <td>{$type.id}</td>
                            <td>{$type.menu_name}</td>
                            <td>
                                {$type.menu_action}
                            </td>
                            <td class="td-manage">
                                <a title="编辑" onclick="xadmin.open('编辑','/admin/permission/{$type.id}/edit','','',true)" href="javascript:;">
                                    <i class="layui-icon">&#xe63c;</i></a>
                                <a title="删除" onclick="news_del(this,'{$type.id}')" href="javascript:;">
                                    <i class="layui-icon">&#xe640;</i></a>
                            </td>
                        </tr>
                        {/volist}
                        </tbody>
                    </table>
                </div>
                <div class="layui-card-body ">
                    {$page|raw}
                </div>
            </div>
        </div>
    </div>
</div>
</body>
<script>
    function news_del(obj, id) {
        layer.confirm('确认要删除吗？',
            function(index) {
                //发异步删除数据
                $.post('/admin/permission/'+id+'/delete',{},function (data) {
                    if(data.error_code == 0){
                        layer.msg('操作成功!', {
                            icon: 1,
                            time: 1000
                        },function () {
                            window.location.reload()
                        });
                    }else{
                        layer.msg('操作失败!', {
                            icon: 1,
                            time: 1000
                        });
                    }
                },"json")

            });
    }


</script>

</html>